﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using MiniFox.Data.EntityFramework;
using MiniFox.Data.EntityFramework.SqlServer;

namespace Platform.Data.Entities.SqlServer;

public partial class PlatformDbContext : SqlServerDbContext
{
    public PlatformDbContext(DbContextOptions<PlatformDbContext> options)
        : base("PlatformDbContext", options)
    {
    }

    public virtual DbSet<DingtalkSent> DingtalkSent { get; set; }

    public virtual DbSet<DsConnection> DsConnection { get; set; }

    public virtual DbSet<DtExcelExport> DtExcelExport { get; set; }

    public virtual DbSet<DtExcelImport> DtExcelImport { get; set; }

    public virtual DbSet<File> File { get; set; }

    public virtual DbSet<Folder> Folder { get; set; }

    public virtual DbSet<MailSent> MailSent { get; set; }

    public virtual DbSet<MailSentFail> MailSentFail { get; set; }

    public virtual DbSet<MessageAttachment> MessageAttachment { get; set; }

    public virtual DbSet<MessageRecv> MessageRecv { get; set; }

    public virtual DbSet<MessageSent> MessageSent { get; set; }

    public virtual DbSet<PublishLog> PublishLog { get; set; }

    public virtual DbSet<RepositorySet> RepositorySet { get; set; }

    public virtual DbSet<SequenceSet> SequenceSet { get; set; }

    public virtual DbSet<SysApp> SysApp { get; set; }

    public virtual DbSet<SysAppSecret> SysAppSecret { get; set; }

    public virtual DbSet<SysAuthCode> SysAuthCode { get; set; }

    public virtual DbSet<SysAuthToken> SysAuthToken { get; set; }

    public virtual DbSet<SysDept> SysDept { get; set; }

    public virtual DbSet<SysDeviceAuth> SysDeviceAuth { get; set; }

    public virtual DbSet<SysDict> SysDict { get; set; }

    public virtual DbSet<SysDictItem> SysDictItem { get; set; }

    public virtual DbSet<SysEnvConfig> SysEnvConfig { get; set; }

    public virtual DbSet<SysJwtToken> SysJwtToken { get; set; }

    public virtual DbSet<SysMenu> SysMenu { get; set; }

    public virtual DbSet<SysMenuLink> SysMenuLink { get; set; }

    public virtual DbSet<SysMenuModule> SysMenuModule { get; set; }

    public virtual DbSet<SysModule> SysModule { get; set; }

    public virtual DbSet<SysModuleAction> SysModuleAction { get; set; }

    public virtual DbSet<SysNav> SysNav { get; set; }

    public virtual DbSet<SysNavLink> SysNavLink { get; set; }

    public virtual DbSet<SysNavModule> SysNavModule { get; set; }

    public virtual DbSet<SysOpenAuthUser> SysOpenAuthUser { get; set; }

    public virtual DbSet<SysOrganization> SysOrganization { get; set; }

    public virtual DbSet<SysPassportToken> SysPassportToken { get; set; }

    public virtual DbSet<SysPassword> SysPassword { get; set; }

    public virtual DbSet<SysPincode> SysPincode { get; set; }

    public virtual DbSet<SysRole> SysRole { get; set; }

    public virtual DbSet<SysRoleModule> SysRoleModule { get; set; }

    public virtual DbSet<SysRoleModuleAction> SysRoleModuleAction { get; set; }

    public virtual DbSet<SysSignLog> SysSignLog { get; set; }

    public virtual DbSet<SysTicket> SysTicket { get; set; }

    public virtual DbSet<SysUser> SysUser { get; set; }

    public virtual DbSet<SysUserConfig> SysUserConfig { get; set; }

    public virtual DbSet<SysUserDept> SysUserDept { get; set; }

    public virtual DbSet<SysUserRole> SysUserRole { get; set; }

    public virtual DbSet<SysUserShortcut> SysUserShortcut { get; set; }

    public virtual DbSet<SysUserTicket> SysUserTicket { get; set; }

    public virtual DbSet<UserWidget> UserWidget { get; set; }

    public virtual DbSet<VersionItem> VersionItem { get; set; }

    public virtual DbSet<VersionSet> VersionSet { get; set; }

    public virtual DbSet<WechatSent> WechatSent { get; set; }

    public virtual DbSet<WorkItem> WorkItem { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<DingtalkSent>(entity =>
        {
            entity.HasKey(e => e.MessageId);

            entity.Property(e => e.MessageId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("MessageID");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Body).HasColumnType("ntext");
            entity.Property(e => e.Data).HasColumnType("ntext");
            entity.Property(e => e.PictureUrl)
                .HasMaxLength(2048)
                .IsUnicode(false);
            entity.Property(e => e.Receiver)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.Response).HasColumnType("ntext");
            entity.Property(e => e.Result).HasColumnType("ntext");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_DingtalkSent_SendTime")
                .HasColumnType("datetime");
            entity.Property(e => e.TaskId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("TaskID");
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Title).HasMaxLength(50);
            entity.Property(e => e.Url)
                .HasMaxLength(2048)
                .IsUnicode(false);
        });

        modelBuilder.Entity<DsConnection>(entity =>
        {
            entity.HasKey(e => e.Name).HasName("PK_DS_Connection");

            entity.ToTable("Ds_Connection");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.ConnectionString)
                .HasMaxLength(1000)
                .IsUnicode(false);
            entity.Property(e => e.ProviderName)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<DtExcelExport>(entity =>
        {
            entity.HasKey(e => e.Name);

            entity.ToTable("Dt_ExcelExport");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Dt_ExcelExport_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.DataLoader)
                .HasMaxLength(100)
                .IsUnicode(false);
            entity.Property(e => e.ExcelFormat)
                .HasMaxLength(10)
                .IsUnicode(false)
                .HasDefaultValue("XLS")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Dt_ExcelExport_ExcelFormat");
            entity.Property(e => e.MaxRowCountPerSheet)
                .HasDefaultValue(65535)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Dt_ExcelExport_MaxRowCountPerSheet");
            entity.Property(e => e.Template)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Dt_ExcelExport_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<DtExcelImport>(entity =>
        {
            entity.HasKey(e => e.Name);

            entity.ToTable("Dt_ExcelImport");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Dt_ExcelImport_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.DataWriter)
                .HasMaxLength(100)
                .IsUnicode(false);
            entity.Property(e => e.MaxImportFileSize)
                .HasDefaultValue(104857600)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Dt_ExcelImport_MaxImortFileSize");
            entity.Property(e => e.Template)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Dt_ExcelImport_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<File>(entity =>
        {
            entity.HasIndex(e => new { e.Group, e.Path, e.FileName }, "UK_File").IsUnique();

            entity.Property(e => e.FileId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("FileID");
            entity.Property(e => e.Accepted)
                .HasDefaultValue(false)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_File_Accepted");
            entity.Property(e => e.ContentLength).HasAnnotation("Relational:DefaultConstraintName", "DF_File_ContentLength");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_File_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.ExtName)
                .HasMaxLength(10)
                .IsUnicode(false);
            entity.Property(e => e.FileName).HasMaxLength(50);
            entity.Property(e => e.Group)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.MimeType)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.Path)
                .HasMaxLength(512)
                .IsUnicode(false)
                .HasDefaultValue("/")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_File_Path");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_File_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<Folder>(entity =>
        {
            entity.HasIndex(e => new { e.Group, e.Path }, "UK_Folder").IsUnique();

            entity.Property(e => e.FolderId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("FolderID");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Folder_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.FolderName).HasMaxLength(50);
            entity.Property(e => e.Group)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Ordinal).HasAnnotation("Relational:DefaultConstraintName", "DF_Folder_Ordinal");
            entity.Property(e => e.Path)
                .HasMaxLength(512)
                .IsUnicode(false);
            entity.Property(e => e.SuperId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("SuperID");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Folder_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<MailSent>(entity =>
        {
            entity.HasKey(e => e.MessageId);

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("MessageID");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.BccList).IsUnicode(false);
            entity.Property(e => e.Body).HasColumnType("ntext");
            entity.Property(e => e.CcList).IsUnicode(false);
            entity.Property(e => e.Receiver)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.SendData).HasColumnType("ntext");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_MailSent_SendTime")
                .HasColumnType("datetime");
            entity.Property(e => e.Sender)
                .HasMaxLength(100)
                .IsUnicode(false);
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Title).HasMaxLength(50);
        });

        modelBuilder.Entity<MailSentFail>(entity =>
        {
            entity.HasKey(e => e.MessageId);

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("MessageID");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.BccList).IsUnicode(false);
            entity.Property(e => e.Body).HasColumnType("ntext");
            entity.Property(e => e.CcList).IsUnicode(false);
            entity.Property(e => e.Exception).HasColumnType("ntext");
            entity.Property(e => e.Receiver)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.SendData).HasColumnType("ntext");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_MailSentFail_SendTime")
                .HasColumnType("datetime");
            entity.Property(e => e.Sender)
                .HasMaxLength(100)
                .IsUnicode(false);
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Title).HasMaxLength(50);
        });

        modelBuilder.Entity<MessageAttachment>(entity =>
        {
            entity.HasKey(e => e.FileId).HasName("PK_AttachmentMessage");

            entity.Property(e => e.FileId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("FileID");
            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("MessageID");
        });

        modelBuilder.Entity<MessageRecv>(entity =>
        {
            entity.HasKey(e => e.MessageId);

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("MessageID");
            entity.Property(e => e.GroupName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.HasRead)
                .HasDefaultValue(false)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_MessageRecv_HasRead");
            entity.Property(e => e.OwnerId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("OwnerID");
            entity.Property(e => e.ReceiveTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_MessageRecv_ReceiveTime")
                .HasColumnType("datetime");
            entity.Property(e => e.SenderId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("SenderID");
            entity.Property(e => e.SenderName).HasMaxLength(50);
            entity.Property(e => e.Title).HasMaxLength(50);
        });

        modelBuilder.Entity<MessageSent>(entity =>
        {
            entity.HasKey(e => e.MessageId);

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("MessageID");
            entity.Property(e => e.GroupName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.ReceiverId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("ReceiverID");
            entity.Property(e => e.ReceiverName).HasMaxLength(50);
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_MessageSent_SendTime")
                .HasColumnType("datetime");
            entity.Property(e => e.SenderId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("SenderID");
            entity.Property(e => e.SenderName).HasMaxLength(50);
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Title).HasMaxLength(50);
        });

        modelBuilder.Entity<PublishLog>(entity =>
        {
            entity.Property(e => e.Id)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.PublishTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_PublishLog_PublisherTime")
                .HasColumnType("datetime");
            entity.Property(e => e.PublisherId)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.PublisherName)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<RepositorySet>(entity =>
        {
            entity.HasKey(e => e.Name);

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Description).HasMaxLength(1000);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_RepositorySet_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<SequenceSet>(entity =>
        {
            entity.HasKey(e => e.Name);

            entity.HasIndex(e => e.Prefix, "UK_SequenceSet").IsUnique();

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.BaseOnUtc)
                .HasDefaultValue(false)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_SequenceSet_BaseOnUTC")
                .HasColumnName("BaseOnUTC");
            entity.Property(e => e.CurrentVal).HasAnnotation("Relational:DefaultConstraintName", "DF_SequenceSet_CurrentVal");
            entity.Property(e => e.Description)
                .HasMaxLength(500)
                .HasComment("描述");
            entity.Property(e => e.Length)
                .HasDefaultValue((byte)4)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_SequenceSet_Length");
            entity.Property(e => e.MaxVal)
                .HasDefaultValue(9999)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_SequenceSet_MaxVal");
            entity.Property(e => e.Pattern)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasDefaultValue("yyyyMMdd")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_SequenceSet_Pattern");
            entity.Property(e => e.Prefix)
                .HasMaxLength(5)
                .IsUnicode(false);
            entity.Property(e => e.Suffix)
                .HasMaxLength(5)
                .IsUnicode(false);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_SequenceSet_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<SysApp>(entity =>
        {
            entity.HasKey(e => e.AppId);

            entity.ToTable("Sys_App");

            entity.HasIndex(e => e.AppName, "UK_Sys_App").IsUnique();

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.AppName).HasMaxLength(50);
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_App_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.Enabled)
                .HasDefaultValue(false)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_App_Enabled");
            entity.Property(e => e.Host)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.Path)
                .HasMaxLength(100)
                .IsUnicode(false);
            entity.Property(e => e.Port)
                .HasMaxLength(5)
                .IsUnicode(false);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_App_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<SysAppSecret>(entity =>
        {
            entity.HasKey(e => e.AppId);

            entity.ToTable("Sys_AppSecret");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.SecretKey)
                .HasMaxLength(128)
                .IsUnicode(false);
            entity.Property(e => e.SignatureKey)
                .HasMaxLength(16)
                .IsUnicode(false);
        });

        modelBuilder.Entity<SysAuthCode>(entity =>
        {
            entity.HasKey(e => new { e.TicketId, e.AppId });

            entity.ToTable("Sys_AuthCode");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.Code)
                .HasMaxLength(512)
                .IsUnicode(false);
            entity.Property(e => e.Context)
                .HasMaxLength(256)
                .IsUnicode(false);
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.ExpireTime).HasColumnType("datetime");
            entity.Property(e => e.Scope)
                .HasMaxLength(20)
                .IsUnicode(false);
        });

        modelBuilder.Entity<SysAuthToken>(entity =>
        {
            entity.HasKey(e => new { e.TicketId, e.AppId });

            entity.ToTable("Sys_AuthToken");

            entity.HasIndex(e => e.AccessToken, "UK_Sys_AuthToken").IsUnique();

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.AccessExpireTime).HasColumnType("datetime");
            entity.Property(e => e.AccessToken)
                .HasMaxLength(512)
                .IsUnicode(false);
            entity.Property(e => e.Context)
                .HasMaxLength(256)
                .IsUnicode(false);
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.RenewExpireTime)
                .HasComment("刷新令牌的过期时间")
                .HasColumnType("datetime");
            entity.Property(e => e.RenewTime)
                .HasComment("最近一次刷新时间")
                .HasColumnType("datetime");
            entity.Property(e => e.RenewToken)
                .HasMaxLength(512)
                .IsUnicode(false);
            entity.Property(e => e.Scope)
                .HasMaxLength(30)
                .IsUnicode(false);
        });

        modelBuilder.Entity<SysDept>(entity =>
        {
            entity.HasKey(e => new { e.OrgId, e.DeptId });

            entity.ToTable("Sys_Dept");

            entity.HasIndex(e => e.DeptPath, "UK_Sys_Dept").IsUnique();

            entity.Property(e => e.OrgId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("所属机构id")
                .HasColumnName("OrgID");
            entity.Property(e => e.DeptId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("部门id")
                .HasColumnName("DeptID");
            entity.Property(e => e.DeptName)
                .HasMaxLength(100)
                .HasComment("部门名称");
            entity.Property(e => e.DeptPath)
                .HasMaxLength(256)
                .HasComment("树节点导航路径");
            entity.Property(e => e.Description)
                .HasMaxLength(500)
                .HasComment("部门描述");
            entity.Property(e => e.Director)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("部门负责人");
            entity.Property(e => e.Enabled)
                .HasDefaultValue(false)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_SysDept_Enabled");
            entity.Property(e => e.Ordinal)
                .HasDefaultValue(0)
                .HasComment("排序字段")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_Dept_Ordinal");
            entity.Property(e => e.ParentId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("上级部门id")
                .HasColumnName("ParentID");
        });

        modelBuilder.Entity<SysDeviceAuth>(entity =>
        {
            entity.HasKey(e => e.TicketId);

            entity.ToTable("Sys_DeviceAuth");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.AuthName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.ExpireTime).HasColumnType("datetime");
            entity.Property(e => e.OpenId)
                .HasMaxLength(128)
                .IsUnicode(false)
                .HasColumnName("OpenID");
        });

        modelBuilder.Entity<SysDict>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.GroupId });

            entity.ToTable("Sys_Dict");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.GroupId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("GroupID");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_Dict_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.Description).HasMaxLength(500);
            entity.Property(e => e.GroupName).HasMaxLength(50);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_Dict_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<SysDictItem>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.GroupId, e.Value });

            entity.ToTable("Sys_DictItem");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.GroupId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("GroupID");
            entity.Property(e => e.Value)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Description).HasMaxLength(500);
            entity.Property(e => e.Text).HasMaxLength(50);
        });

        modelBuilder.Entity<SysEnvConfig>(entity =>
        {
            entity.ToTable("Sys_EnvConfig");

            entity.Property(e => e.Id).HasColumnName("ID");
            entity.Property(e => e.ConfigData)
                .HasDefaultValue("{}")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_EnvConfig_ConfigData");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_EnvConfig_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<SysJwtToken>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PK_Sys_AccessToken_1");

            entity.ToTable("Sys_JwtToken");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.Algorithm)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.ExpireTime).HasColumnType("datetime");
            entity.Property(e => e.Issuer)
                .HasMaxLength(32)
                .IsUnicode(false);
            entity.Property(e => e.Signature)
                .HasMaxLength(512)
                .IsUnicode(false);
            entity.Property(e => e.Subscriber)
                .HasMaxLength(32)
                .IsUnicode(false);
            entity.Property(e => e.TokenType)
                .HasMaxLength(20)
                .IsUnicode(false);
        });

        modelBuilder.Entity<SysMenu>(entity =>
        {
            entity.HasKey(e => new { e.MenuId, e.AppId });

            entity.ToTable("Sys_Menu");

            entity.HasIndex(e => e.MenuId, "IX_Sys_Menu");

            entity.Property(e => e.MenuId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("菜单id")
                .HasColumnName("MenuID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("所属应用ID")
                .HasColumnName("AppID");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .IsUnicode(false)
                .HasComment("菜单图标");
            entity.Property(e => e.Label)
                .HasMaxLength(10)
                .HasComment("标签");
            entity.Property(e => e.MenuName)
                .HasMaxLength(50)
                .HasComment("菜单名");
            entity.Property(e => e.MenuPath)
                .HasMaxLength(256)
                .HasComment("树型导航路径");
            entity.Property(e => e.Ordinal).HasComment("排序字段");
            entity.Property(e => e.ParentId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("父级菜单id")
                .HasColumnName("ParentID");
        });

        modelBuilder.Entity<SysMenuLink>(entity =>
        {
            entity.HasKey(e => e.LinkId);

            entity.ToTable("Sys_MenuLink");

            entity.Property(e => e.LinkId)
                .HasMaxLength(46)
                .IsUnicode(false)
                .HasColumnName("LinkID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.Label).HasMaxLength(10);
            entity.Property(e => e.LinkName).HasMaxLength(30);
            entity.Property(e => e.LinkUri)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.MenuId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("MenuID");
            entity.Property(e => e.OpenMode)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasDefaultValue("NewTab")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_MenuLink_OpenMode");
            entity.Property(e => e.Ordinal)
                .HasDefaultValue(0)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_MenuLink_Ordinal");
        });

        modelBuilder.Entity<SysMenuModule>(entity =>
        {
            entity.HasKey(e => new { e.MenuId, e.AppId, e.ModuleId });

            entity.ToTable("Sys_MenuModule");

            entity.Property(e => e.MenuId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("MenuID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("ModuleID");
            entity.Property(e => e.Label).HasMaxLength(10);
            entity.Property(e => e.Ordinal)
                .HasDefaultValue(0)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_MenuModule_Ordinal");
        });

        modelBuilder.Entity<SysModule>(entity =>
        {
            entity.HasKey(e => e.ModuleId);

            entity.ToTable("Sys_Module");

            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("模块id")
                .HasColumnName("ModuleID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("所属应用")
                .HasColumnName("AppID");
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.Enabled)
                .HasDefaultValue(true)
                .HasComment("是否启用")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_Module_Enabled");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .IsUnicode(false)
                .HasComment("模块图标");
            entity.Property(e => e.IsPublic)
                .HasDefaultValue(false)
                .HasComment("是否为公共模块(公共模块无需鉴权)")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_Module_IsPublic");
            entity.Property(e => e.ModuleName)
                .HasMaxLength(30)
                .HasComment("模块名称");
            entity.Property(e => e.ModuleUri)
                .HasMaxLength(200)
                .IsUnicode(false)
                .HasComment("模块路径(相对路径)");
            entity.Property(e => e.OpenMode)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasComment("打开模式");
            entity.Property(e => e.QueryString)
                .HasMaxLength(100)
                .HasComment("静态参数");
            entity.Property(e => e.UpdateTime).HasColumnType("datetime");
        });

        modelBuilder.Entity<SysModuleAction>(entity =>
        {
            entity.HasKey(e => e.ActionId);

            entity.ToTable("Sys_ModuleAction");

            entity.Property(e => e.ActionId)
                .HasMaxLength(46)
                .IsUnicode(false)
                .HasColumnName("ActionID");
            entity.Property(e => e.ActionName).HasMaxLength(50);
            entity.Property(e => e.ActionUri)
                .HasMaxLength(200)
                .IsUnicode(false)
                .HasDefaultValueSql("((0))")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_ModuleAction_ActionUri");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_ModuleAction_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("ModuleID");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_ModuleAction_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<SysNav>(entity =>
        {
            entity.HasKey(e => new { e.NavId, e.AppId }).HasName("PK_Sys_Navigation");

            entity.ToTable("Sys_Nav");

            entity.HasIndex(e => e.NavId, "IX_Sys_Navigation").IsUnique();

            entity.Property(e => e.NavId)
                .HasMaxLength(46)
                .IsUnicode(false)
                .HasColumnName("NavID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.Label).HasMaxLength(10);
            entity.Property(e => e.NavName).HasMaxLength(20);
            entity.Property(e => e.ParentId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("ParentID");
        });

        modelBuilder.Entity<SysNavLink>(entity =>
        {
            entity.HasKey(e => e.LinkId).HasName("PK_Sys_NavigationLink");

            entity.ToTable("Sys_NavLink");

            entity.Property(e => e.LinkId)
                .HasMaxLength(46)
                .IsUnicode(false)
                .HasColumnName("LinkID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.Label).HasMaxLength(10);
            entity.Property(e => e.LinkName).HasMaxLength(30);
            entity.Property(e => e.LinkUri)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.NavId)
                .HasMaxLength(46)
                .IsUnicode(false)
                .HasColumnName("NavID");
            entity.Property(e => e.OpenMode)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasDefaultValueSql("((0))")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_NavigationLink_OpenMode");
        });

        modelBuilder.Entity<SysNavModule>(entity =>
        {
            entity.HasKey(e => new { e.NavId, e.AppId, e.ModuleId }).HasName("PK_Sys_NavigationModule");

            entity.ToTable("Sys_NavModule");

            entity.Property(e => e.NavId)
                .HasMaxLength(46)
                .IsUnicode(false)
                .HasColumnName("NavID");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("AppID");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("ModuleID");
            entity.Property(e => e.Label).HasMaxLength(10);
            entity.Property(e => e.Ordinal)
                .HasDefaultValue(0)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_NavModule_Ordinal");
        });

        modelBuilder.Entity<SysOpenAuthUser>(entity =>
        {
            entity.HasKey(e => new { e.OpenId, e.AuthName });

            entity.ToTable("Sys_OpenAuthUser");

            entity.Property(e => e.OpenId)
                .HasMaxLength(128)
                .IsUnicode(false)
                .HasColumnName("OpenID");
            entity.Property(e => e.AuthName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
        });

        modelBuilder.Entity<SysOrganization>(entity =>
        {
            entity.HasKey(e => e.OrgId);

            entity.ToTable("Sys_Organization");

            entity.Property(e => e.OrgId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("机构id")
                .HasColumnName("OrgID");
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.Description)
                .HasMaxLength(500)
                .HasComment("描述");
            entity.Property(e => e.DisplayName)
                .HasMaxLength(100)
                .HasComment("显示名称");
            entity.Property(e => e.Icon)
                .HasMaxLength(100)
                .IsUnicode(false)
                .HasComment("图标");
            entity.Property(e => e.Logo)
                .HasMaxLength(100)
                .IsUnicode(false)
                .HasComment("商标");
            entity.Property(e => e.OrgName)
                .HasMaxLength(100)
                .HasComment("机构名");
            entity.Property(e => e.UpdateTime).HasColumnType("datetime");
        });

        modelBuilder.Entity<SysPassportToken>(entity =>
        {
            entity.HasKey(e => e.TicketId);

            entity.ToTable("Sys_PassportToken");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.ClientIp)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("ClientIP");
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.Duration)
                .HasDefaultValue(7200)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_PassportToken_Duration");
            entity.Property(e => e.ExpireTime).HasColumnType("datetime");
            entity.Property(e => e.RenewTime).HasColumnType("datetime");
            entity.Property(e => e.UserAgent)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
        });

        modelBuilder.Entity<SysPassword>(entity =>
        {
            entity.HasKey(e => e.UserId);

            entity.ToTable("Sys_Password");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
            entity.Property(e => e.Password)
                .HasMaxLength(128)
                .IsUnicode(false);
        });

        modelBuilder.Entity<SysPincode>(entity =>
        {
            entity.HasKey(e => e.TicketId);

            entity.ToTable("Sys_Pincode");

            entity.Property(e => e.TicketId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.Code)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.ExpireTime).HasColumnType("datetime");
            entity.Property(e => e.SignName)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<SysRole>(entity =>
        {
            entity.HasKey(e => e.RoleId);

            entity.ToTable("Sys_Role");

            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("角色id")
                .HasColumnName("RoleID");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_Role_CreateTime")
                .HasColumnType("datetime");
            entity.Property(e => e.Description)
                .HasMaxLength(200)
                .HasComment("描述");
            entity.Property(e => e.RoleName)
                .HasMaxLength(50)
                .HasComment("角色id");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_Role_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<SysRoleModule>(entity =>
        {
            entity.HasKey(e => new { e.RoleId, e.ModuleId });

            entity.ToTable("Sys_RoleModule");

            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("RoleID");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("ModuleID");
        });

        modelBuilder.Entity<SysRoleModuleAction>(entity =>
        {
            entity.HasKey(e => new { e.RoleId, e.ModuleId, e.ActionId });

            entity.ToTable("Sys_RoleModuleAction");

            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("RoleID");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("ModuleID");
            entity.Property(e => e.ActionId)
                .HasMaxLength(46)
                .IsUnicode(false)
                .HasColumnName("ActionID");
        });

        modelBuilder.Entity<SysSignLog>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PK_Sys_SignInLog");

            entity.ToTable("Sys_SignLog");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.Browser).HasMaxLength(50);
            entity.Property(e => e.Cellphone)
                .HasMaxLength(16)
                .IsUnicode(false);
            entity.Property(e => e.Device).HasMaxLength(100);
            entity.Property(e => e.IpAddress)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.LoginName)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.NickName).HasMaxLength(30);
            entity.Property(e => e.Platform).HasMaxLength(100);
            entity.Property(e => e.SecEmail)
                .HasMaxLength(320)
                .IsUnicode(false);
            entity.Property(e => e.SignOffTime).HasColumnType("datetime");
            entity.Property(e => e.SignOnTime).HasColumnType("datetime");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
        });

        modelBuilder.Entity<SysTicket>(entity =>
        {
            entity.HasKey(e => e.TicketId);

            entity.ToTable("Sys_Ticket");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.Data)
                .HasMaxLength(512)
                .IsUnicode(false);
            entity.Property(e => e.ExpireTime).HasColumnType("datetime");
            entity.Property(e => e.TicketType)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasComment("票据类型 \r\n1 帐户激活\r\n2 找回密码");
        });

        modelBuilder.Entity<SysUser>(entity =>
        {
            entity.HasKey(e => e.UserId);

            entity.ToTable("Sys_User");

            entity.HasIndex(e => e.LoginName, "UK_Sys_User").IsUnique();

            entity.HasIndex(e => e.Cellphone, "UK_Sys_User_Cellphone").IsUnique();

            entity.HasIndex(e => e.SecEmail, "UK_Sys_User_SecEmail").IsUnique();

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasComment("用户id")
                .HasColumnName("UserID");
            entity.Property(e => e.Cellphone)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasComment("手机号");
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.DisplayName)
                .HasMaxLength(50)
                .HasComment("用户显示名");
            entity.Property(e => e.LoginName)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasComment("账号名");
            entity.Property(e => e.SecEmail)
                .HasMaxLength(100)
                .IsUnicode(false)
                .HasComment("安全邮箱");
            entity.Property(e => e.UpdateTime).HasColumnType("datetime");
            entity.Property(e => e.UserStatus)
                .HasMaxLength(20)
                .IsUnicode(false)
                .HasComment("用户状态");
        });

        modelBuilder.Entity<SysUserConfig>(entity =>
        {
            entity.HasKey(e => e.UserId);

            entity.ToTable("Sys_UserConfig");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
            entity.Property(e => e.ConfigData)
                .IsUnicode(false)
                .HasDefaultValue("{}")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_UserConfig_ConfigData");
            entity.Property(e => e.Region)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.TimeZone)
                .HasMaxLength(100)
                .IsUnicode(false);
        });

        modelBuilder.Entity<SysUserDept>(entity =>
        {
            entity.HasKey(e => new { e.UserId, e.DeptPath });

            entity.ToTable("Sys_UserDept");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
            entity.Property(e => e.DeptPath).HasMaxLength(256);
        });

        modelBuilder.Entity<SysUserRole>(entity =>
        {
            entity.HasKey(e => new { e.RoleId, e.UserId });

            entity.ToTable("Sys_UserRole");

            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("RoleID");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
        });

        modelBuilder.Entity<SysUserShortcut>(entity =>
        {
            entity.HasKey(e => new { e.UserId, e.ModuleId });

            entity.ToTable("Sys_UserShortcut");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("ModuleID");
            entity.Property(e => e.Ordinal)
                .HasDefaultValue(0)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Sys_UserShortcut_Ordinal");
        });

        modelBuilder.Entity<SysUserTicket>(entity =>
        {
            entity.HasKey(e => e.TicketId);

            entity.ToTable("Sys_UserTicket");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("TicketID");
            entity.Property(e => e.CreateTime).HasColumnType("datetime");
            entity.Property(e => e.ExpireTime).HasColumnType("datetime");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
        });

        modelBuilder.Entity<UserWidget>(entity =>
        {
            entity.HasKey(e => new { e.UserId, e.WidgetName });

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .IsUnicode(false)
                .HasColumnName("UserID");
            entity.Property(e => e.WidgetName)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.Ordinal)
                .HasDefaultValue(0)
                .HasAnnotation("Relational:DefaultConstraintName", "DF_UserWidget_Ordinal");
        });

        modelBuilder.Entity<VersionItem>(entity =>
        {
            entity.Property(e => e.Id).ValueGeneratedNever();
            entity.Property(e => e.AuthorId)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.AuthorName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Comment)
                .HasMaxLength(1000)
                .IsUnicode(false);
            entity.Property(e => e.Operation)
                .HasMaxLength(20)
                .IsUnicode(false);
            entity.Property(e => e.RepoName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.VersionSetName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.VersionTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_VersionItem_VersionTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<VersionSet>(entity =>
        {
            entity.HasKey(e => new { e.Name, e.RepoName }).HasName("PK_VersionSet_1");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.RepoName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Description).HasMaxLength(1000);
            entity.Property(e => e.PubId)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_VersionSet_UpdateTime")
                .HasColumnType("datetime");
        });

        modelBuilder.Entity<WechatSent>(entity =>
        {
            entity.HasKey(e => e.MessageId).HasName("PK_Table_1");

            entity.Property(e => e.MessageId)
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasColumnName("MessageID");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Body).HasColumnType("ntext");
            entity.Property(e => e.Data).HasColumnType("ntext");
            entity.Property(e => e.PictureUrl)
                .HasMaxLength(2048)
                .IsUnicode(false);
            entity.Property(e => e.Receiver)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.Response).HasColumnType("ntext");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Table_1_SendTime")
                .HasColumnType("datetime");
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Title).HasMaxLength(50);
            entity.Property(e => e.Url)
                .HasMaxLength(2048)
                .IsUnicode(false);
        });

        modelBuilder.Entity<WorkItem>(entity =>
        {
            entity.HasKey(e => new { e.Name, e.RepoName, e.OwnerId });

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.RepoName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.OwnerId)
                .HasMaxLength(64)
                .IsUnicode(false);
            entity.Property(e => e.Description).HasMaxLength(1000);
            entity.Property(e => e.OwnerName)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("(getdate())")
                .HasAnnotation("Relational:DefaultConstraintName", "DF_Table_1_VersionTime")
                .HasColumnType("datetime");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
